package com.zjgk.bigclassenv.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Result{
    public static final int SUCCESS = 200;
    public static final int SERVER_ERROR = 500;
    public static final int USER_ERROR = 501;
    public static final int NOT_LOGGED = 502;
    public static final int PERMISSION_ERROR = 503;


    int code;
    String msg;
    Object data;
    public String switchTime(Long time){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        return sdf.format(time);// 格式化时间

    }

    public Result(int code, String msg) {
        this(code, msg, null);
    }
}
